(SST) ShlWAPI.pas Version 1.08

Developer Reference
(SST)ShlWAPI IsOS Function
Function that can be used to check if the operating system has a certain version, feature, configuration, or characteristic.
Scope
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas).
Syntax
function IsOS(dwOS : DWORD) : BOOL;  
Parameters
dwOS [in] A unsigned double word (32-bit) value representing the version, feature, configuration, or characteristic, to be determined. The caller can specify one of the following, predefined values:
Symbolic Name Value Description*1
OS_WINDOWS 0 The operating system architecture is based on Microsoft's DOS/Windows 95 system architecture. These operating systems are commonly referred to as Windows 9x.
OS_NT 1 The operating system architecture is based on Microsoft's New Technology (NT) system architecture.
OS_WIN95ORGREATER 2 The operating system is based on the DOS/Windows 95 system archicture and is Windows 95 or a version that superseded it in the Windows 9x product line (i.e. Windows 95 OSR2, 98, 98 Second Edition (SE), Millenium Edition (ME)).
OS_NT4ORGREATER 3 The operating system is Windows NT 4.0 or a later NT version (e.g. Windows 2000, Windows XP).
OS_WIN2000ORGREATER_ALT 4 Obsolete value and symbolic name that were replaced by OS_WIN2000ORGREATER. However, the value seems to be supported up to and including, at least, Windows Vista (with SP1 & IE 8).
OS_WIN98ORGREATER 5 The operating system is based on the DOS/Windows 95 system archicture and is Windows 98 or a version that superseded it in the Windows 9x product line (i.e. Windows 98 Second Edition (SE), Windows Millenium Editon (ME)).
OS_WIN98_GOLD 6 The operating system is based on the DOS/Windows 95 system archicture and is Windows 98 (i.e. version 4.10 build 1998).
Windows 98 SE (i.e. version 4.10 build 2222) is not considered Windows 98 in this context (i.e. FALSE is returned when querying this value under 98 SE).
OS_WIN2000ORGREATER 7 The operating system is Windows 2000 (i.e. NT 5.0) or a later NT version.
OS_WIN2000PRO 8 The operating system is the Professional Edition of the Windows 2000 (i.e. NT 5.0) or XP, (i.e. NT 5.1) workstation version.
FALSE appears to be returned under the Professional editions of successor versions (e.g. Vista).
OS_WIN2000SERVER 9 The operating system is the Server Standard Edtion of Windows 2000 (i.e. NT 5.0) or Windows 2003 (i.e. NT 5.1).
Although the Microsoft doc. on this value suggests that TRUE is only returned under server systems without license restrictions (e.g. the already mentioned), it is also returned under Windows 2003 Home/Small Business Server (with SP 1, but without upgrages).
OS_WIN2000ADVSERVER 10 The operating system is the Advanced Server Edtion of Windows 2000 (i.e. NT 5.0) or the Enterprise Edition of Windows Server 2003 (i.e. NT 5.1).
Although not explicitly stated by the Microsoft documentation, TRUE is presumably also returned under versions that supersede these two versions.
OS_WIN2000DATACENTER 11 The operating system is the Datacenter Server Edtion of Windows 2000 (i.e. NT 5.0) or 2003 (i.e. NT 5.1).
Although not explicitly stated by the Microsoft documentation, TRUE is presumably also returned for versions that supersede these two versions.
OS_WIN2000TERMINAL 12 The operating system is a Windows 2000, server (as opposed to a workstation) edition, or a later server version, and the calling application is being executed as a terminal client (e.g. on a remote desktop).
OS_EMBEDDED 13 The operating system is the Embedded edition of Windows XP or a successor version thereof.
OS_TERMINALCLIENT 14 The application is being executed as a terminal client (e.g. on a remote desktop).
OS_TERMINALREMOTEADMIN 15 Appears to be returned when a user with administrator privileges is logged on to a server via remote desktop.
Might also be returned while logged on to a workstation via a remote desktop.
OS_WIN95_GOLD 16 The operating system is based on the DOS/Windows 95 system archicture and is Windows 95.
It remains to be clarified if Windows 95 OSR2 () is considered Windows 95 in this context.
OS_MEORGREATER 17 The operating system is based on the DOS/Windows 95 system archicture and is the version 4.90 of this product line (i.e. Windows Millenium Edition (ME)).
OS_XPORGREATER 18 The operating system is Windows NT 5.1 (aka Windows XP) or a later NT version.
Appears to be returned for both workstation AND server versions.
OS_HOME 19 The operating system is the Home Edition of this particular Windows, version.
Does not appear to be returned for server versions (i.e. appears to be restricted to workstation versions)
OS_PROFESSIONAL 20 The operating system is the Professional Edition of this particular Windows version.
OS_DATACENTER 21 The operating system is the Datacenter Edition of this particular Windows version.
OS_ADVSERVER 22 The operating system is the Advanced Server Edition of this particular Windows version.
OS_SERVER 23 The operating system is a Standard edition of a Windows server version.
TRUE is preumably only returned on Windows server systems without restrictions on the number of client systems.
OS_TERMINALSERVER 24 The operating system is a Windows 2000 Terminal Server edition, running in Application Server mode, Windows Server 2003 or a successer thereof, running in Terminal Server mode.
OS_PERSONALTERMINALSERVER 25 The operating system is the Home or Professional edition of this Windows (wrokstation) version.
OS_FASTUSERSWITCHING 26 The operating system supports fast user switching.
OS_WELCOMELOGONUI 27 The operating system supports a full screen, logon, user interface. Does not return TRUE under Vista with SP 1 & IE 8.
OS_DOMAINMEMBER 28 The computer is a member of a Windows Network domain.
OS_ANYSERVER 29 The operating system is a Windows server, as opposed to a workstation, version.
OS_WOW6432 30 The system supports 64 to 32 bit thunking. In other words; support for the execution of 32-bit, binary code on 64-bit hardware/operating systems.
OS_WEBSERVER 31 The operating system is the Web Edition of Windows 2003 Server or a successor version.
Whether or not a web server is installed and/or active on the system does not seem have any influence on the result.
OS_SMALLBUSINESSSERVER 32 The operating system is a Small Business Server edition with license restrictions on the number of client systems.
Appears to be TRUE for all systems with license restrictions (e.g. also returns TRUE on Homes Server editions).
OS_TABLETPC 33 The operating system is an edition for tablet PCs.
OS_SERVERADMINUI 34 The application is running under a server administration user interface.
OS_MEDIACENTER 35 The operating system is a Windows Media Center edition.
OS_APPLIANCE 36 The operating system is a Windows Appliance Server edition.
Return Values
Returns TRUE (≠ 0, typically 1) if the operating system under which the function is executed has the specified version, feature, configuration, or characteristic, FALSE (= 0) if not.
Remarks
By calling it with parameter OS_WOW6432, the function can be used to reliably determine if the application is running on a 64-bit system (see OS_WOW6432, above).
The function was not documented up to and including MS SDK version 6.0.
Although the function was thoroughly documented (in the documentation accompanying Ms SDK version 6.1) a few obvious inconsistencies seem to have been missed. These being:
  • In the header in which it is declared in Ms SDK version 6.1 (ShlWAPI.h), the function is enclosed in the compiler directive "_WIN32_IE >= _WIN32_IE_IE501". This automatically excludes the function from being imported in versions pre-dating Windows ME/2000, which is obviously incompatible with parameters capable of determining whether the function is being executed under Windows 95, 98, and NT 4.0.
  • The table in which the parameter constants/values are described contains numerous entries that do not make a whole lot of sense. For example: In the rows that describe OS_WIN95_GOLD and OS_WIN98_GOLD (taking the two most obvious), the entries in the "Supported On" column state that these values are supported under "Windows 2000/Windows XP/Windows Server 2003".
  • The minimum operating system versions, listed in the Requirements section at the bottom of the page, do not include any Win 9x products, although the function is not only capable of identifying the product line, but also the individual products/versions.
As we did not have systems with shell/IE version 4.0 (i.e. ShlWAPI.dll version 4.71) at our disposal and the Microsoft documentation on the function was/is somewhat ambiguous, it is not entirely clear as of which ShlWAPI.dll version (exactly) the function is exported by ordinal 437. We have therefore decided to specify the earliest version we were able to determine, in the Requirements section, below. This happens to be the version also documented by Microsoft in the documentation accompanying Ms SDK 6.1. However, based on the fact that IsOS is capable of detecting Windows 95 (or at least 98) and that is mentioned in the Microsoft article on IsOS, it is not only conceivable, but probable, that the function is also implemented in the earliest ShlWAPI.dll version, 4.71 (i.e. as of IE 4.0).
The function continues to be supported under Windows 10.
(*1) Although the descriptions are largely based on those provided by the documentation accompanying Ms SDK version 6.1, several were supplemented by the information gained through tests under various operating system versions.
Example
PROCEDURE TForm4.TestShlWAPIIsOS(Sender : TObject); //The import by ordinal 437 appears to be documented correctly !!! VAR apiretval : BOOL; VAR i : DWORD; VAR newinfoline : STRING; BEGIN apiretval := FALSE; i := 0; newinfoline := ''; FOR i := OS_WINDOWS TO OS_APPLIANCE DO BEGIN apiretval := FALSE; IF i <> 4 THEN //Test for obsolete value BEGIN CASE i OF 0 : newinfoline := 'OS_WINDOWS'; 1 : newinfoline := ' OS_NT'; 2 : newinfoline := ' OS_WIN95ORGREATER'; 3 : newinfoline := ' OS_NT4ORGREATER'; 5 : newinfoline := ' OS_WIN98ORGREATER'; 6 : newinfoline := ' OS_WIN98_GOLD'; 7 : newinfoline := ' OS_WIN2000ORGREATER'; 8 : newinfoline := ' OS_WIN2000PRO'; 9 : newinfoline := ' OS_WIN2000SERVER'; 10 : newinfoline := ' OS_WIN2000ADVSERVER'; 11 : newinfoline := ' OS_WIN2000DATACENTER'; 12 : newinfoline := ' OS_WIN2000TERMINAL'; 13 : newinfoline := ' OS_EMBEDDED'; 14 : newinfoline := ' OS_TERMINALCLIENT'; 15 : newinfoline := ' OS_TERMINALREMOTEADMIN'; 16 : newinfoline := ' OS_WIN95_GOLD'; 17 : newinfoline := ' OS_MEORGREATER'; 18 : newinfoline := ' OS_XPORGREATER'; 19 : newinfoline := ' OS_HOME'; 20 : newinfoline := ' OS_PROFESSIONAL'; 21 : newinfoline := ' OS_DATACENTER'; 22 : newinfoline := ' OS_ADVSERVER'; 23 : newinfoline := ' OS_SERVER'; 24 : newinfoline := ' OS_TERMINALSERVER'; 25 : newinfoline := ' OS_PERSONALTERMINALSERVER'; 26 : newinfoline := ' OS_FASTUSERSWITCHING'; 27 : newinfoline := ' OS_WELCOMELOGONUI'; 28 : newinfoline := ' OS_DOMAINMEMBER'; 29 : newinfoline := ' OS_ANYSERVER'; 30 : newinfoline := ' OS_WOW6432'; 31 : newinfoline := ' OS_WEBSERVER'; 32 : newinfoline := ' OS_SMALLBUSINESSSERVER'; 33 : newinfoline := ' OS_TABLETPC'; 34 : newinfoline := ' OS_SERVERADMINUI'; 35 : newinfoline := ' OS_MEDIACENTER'; 36 : newinfoline := ' OS_APPLIANCE'; END; newinfoline := 'IsOS called with ' + newinfoline + ' (' + IntToStr(i) + ')'; Memo1.Lines.Add(newinfoline); apiretval := IsOS(i) ; IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); END; END; Memo1.Lines.Add(''); END;
When run on a Windows Vista Business (with Service Pack 1 & IE 8) workstation, the above code produces the following output:
IsOS called with OS_WINDOWS (0) FALSE IsOS called with OS_NT (1) TRUE IsOS called with OS_WIN95ORGREATER (2) FALSE IsOS called with OS_NT4ORGREATER (3) TRUE IsOS called with OS_WIN98ORGREATER (5) FALSE IsOS called with OS_WIN98_GOLD (6) FALSE IsOS called with OS_WIN2000ORGREATER (7) TRUE IsOS called with OS_WIN2000PRO (8) FALSE IsOS called with OS_WIN2000SERVER (9) FALSE IsOS called with OS_WIN2000ADVSERVER (10) FALSE IsOS called with OS_WIN2000DATACENTER (11) FALSE IsOS called with OS_WIN2000TERMINAL (12) FALSE IsOS called with OS_EMBEDDED (13) FALSE IsOS called with OS_TERMINALCLIENT (14) FALSE IsOS called with OS_TERMINALREMOTEADMIN (15) FALSE IsOS called with OS_WIN95_GOLD (16) FALSE IsOS called with OS_MEORGREATER (17) FALSE IsOS called with OS_XPORGREATER (18) TRUE IsOS called with OS_HOME (19) FALSE IsOS called with OS_PROFESSIONAL (20) TRUE IsOS called with OS_DATACENTER (21) FALSE IsOS called with OS_ADVSERVER (22) FALSE IsOS called with OS_SERVER (23) FALSE IsOS called with OS_TERMINALSERVER (24) FALSE IsOS called with OS_PERSONALTERMINALSERVER (25) TRUE IsOS called with OS_FASTUSERSWITCHING (26) TRUE IsOS called with OS_WELCOMELOGONUI (27) FALSE IsOS called with OS_DOMAINMEMBER (28) FALSE IsOS called with OS_ANYSERVER (29) FALSE IsOS called with OS_WOW6432 (30) FALSE IsOS called with OS_WEBSERVER (31) FALSE IsOS called with OS_SMALLBUSINESSSERVER (32) FALSE IsOS called with OS_TABLETPC (33) FALSE IsOS called with OS_SERVERADMINUI (34) FALSE IsOS called with OS_MEDIACENTER (35) FALSE IsOS called with OS_APPLIANCE (36) FALSE
Requirements
Unit: Declared and imported in (SST)ShlWAPI.pas
Library: (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj
Unicode: Not applicable.
Min. ShlWAPI.dll version according to MS SDK doc.: 5.0
Min. ShlWAPI.dll version based on SST research: 5.0
Min. OS version(s) according to Microsoft SDK doc.: Windows 2000, Windows 2000 Server, Windows Server 2003, Windows XP
Min. OS version(s) according to SST research.: Windows 98 with IE 5.0, Windows NT 4.0 with IE 5.0
See Also
 
 
Windows APIs: IsOS.


Document/Contents version 1.00
Page/URI last updated on 07.12.2023
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com